package crp.core.course.domain.repositories;

import com.qwlabs.lang.C2;
import crp.core.course.domain.models.PlanCourseEntity;
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
import io.quarkus.panache.common.Parameters;

import javax.enterprise.context.ApplicationScoped;
import java.util.Collection;
import java.util.stream.Stream;

@ApplicationScoped
public class PlanCourseRepository implements PanacheRepositoryBase<PlanCourseEntity, String> {

    public Stream<PlanCourseEntity> findByIds(Collection<String> ids) {
        if(C2.isEmpty(ids)){
            return Stream.empty();
        }
        return find("id in (:ids)", Parameters.with("ids", ids)).stream();
    }
}
